Location: SLC transporters @ ca447f870d3b / Facilitated transporter / CellMLV2 / GLUT1_BG.py

Author:
Weiwei Ai <wai484@aucklanduni.ac.nz>
Date:
2024-04-19 17:04:11+12:00
Desc:
Add bond graph models for ref 2005 fig 3B
Permanent Source URI:
http://models.cellml.org/workspace/b65/rawfile/ca447f870d3be12963a885d5acd8da79af2a683d/Facilitated transporter/CellMLV2/GLUT1_BG.py

# The content of this file was generated using the Python profile of libCellML 0.5.0.

from enum import Enum
from math import *


__version__ = "0.4.0"
LIBCELLML_VERSION = "0.5.0"

STATE_COUNT = 4
VARIABLE_COUNT = 48


class VariableType(Enum):
    VARIABLE_OF_INTEGRATION = 0
    STATE = 1
    CONSTANT = 2
    COMPUTED_CONSTANT = 3
    ALGEBRAIC = 4


VOI_INFO = {"name": "t", "units": "second", "component": "GLUT1_BG", "type": VariableType.VARIABLE_OF_INTEGRATION}

STATE_INFO = [
    {"name": "q_1", "units": "fmol", "component": "GLUT1_BG", "type": VariableType.STATE},
    {"name": "q_2", "units": "fmol", "component": "GLUT1_BG", "type": VariableType.STATE},
    {"name": "q_3", "units": "fmol", "component": "GLUT1_BG", "type": VariableType.STATE},
    {"name": "q_4", "units": "fmol", "component": "GLUT1_BG", "type": VariableType.STATE}
]

VARIABLE_INFO = [
    {"name": "q_init_Ao", "units": "fmol", "component": "params_BG", "type": VariableType.COMPUTED_CONSTANT},
    {"name": "g_o", "units": "mM", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "V_o", "units": "pL", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "q_init_Ai", "units": "fmol", "component": "params_BG", "type": VariableType.COMPUTED_CONSTANT},
    {"name": "g_i", "units": "mM", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "V_i", "units": "pL", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "R", "units": "J_per_K_mol", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "T", "units": "kelvin", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_Ai", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_Ao", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_1", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "q_init_1", "units": "fmol", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_2", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "q_init_2", "units": "fmol", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_3", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "q_init_3", "units": "fmol", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_4", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "q_init_4", "units": "fmol", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "kappa_r1", "units": "fmol_per_s_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "kappa_r2", "units": "fmol_per_s_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "kappa_r3", "units": "fmol_per_s_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "kappa_r4", "units": "fmol_per_s_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "mu_Ai", "units": "J_per_mol", "component": "GLUT1_BG", "type": VariableType.COMPUTED_CONSTANT},
    {"name": "q_Ai", "units": "fmol", "component": "GLUT1_BG", "type": VariableType.COMPUTED_CONSTANT},
    {"name": "mu_Ao", "units": "J_per_mol", "component": "GLUT1_BG", "type": VariableType.COMPUTED_CONSTANT},
    {"name": "q_Ao", "units": "fmol", "component": "GLUT1_BG", "type": VariableType.COMPUTED_CONSTANT},
    {"name": "mu_1", "units": "J_per_mol", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_1", "units": "fmol_per_s", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "mu_2", "units": "J_per_mol", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_2", "units": "fmol_per_s", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "mu_3", "units": "J_per_mol", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_3", "units": "fmol_per_s", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "mu_4", "units": "J_per_mol", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_4", "units": "fmol_per_s", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_r1", "units": "fmol_per_s", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_f_r1", "units": "J_per_mol", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_r_r1", "units": "J_per_mol", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_r2", "units": "fmol_per_s", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_f_r2", "units": "J_per_mol", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_r_r2", "units": "J_per_mol", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_r3", "units": "fmol_per_s", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_f_r3", "units": "J_per_mol", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_r_r3", "units": "J_per_mol", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_r4", "units": "fmol_per_s", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_f_r4", "units": "J_per_mol", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_r_r4", "units": "J_per_mol", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_Ai", "units": "fmol_per_s", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_Ao", "units": "fmol_per_s", "component": "GLUT1_BG", "type": VariableType.ALGEBRAIC}
]


def create_states_array():
    return [nan]*STATE_COUNT


def create_variables_array():
    return [nan]*VARIABLE_COUNT


def initialise_variables(states, rates, variables):
    variables[1] = 1.0e-5
    variables[2] = 0.09
    variables[4] = 10.0
    variables[5] = 0.09
    variables[6] = 8.31
    variables[7] = 273.15
    variables[8] = 149.65
    variables[9] = 149.65
    variables[10] = 33.20
    variables[11] = 0.0017
    variables[12] = 4.25e+03
    variables[13] = 0.0017
    variables[14] = 344.59
    variables[15] = 0.0017
    variables[16] = 1.99
    variables[17] = 0.0017
    variables[18] = 0.36
    variables[19] = 0.26
    variables[20] = 1.01e+05
    variables[21] = 1.01e+04
    states[0] = variables[11]
    states[1] = variables[13]
    states[2] = variables[15]
    states[3] = variables[17]


def compute_computed_constants(variables):
    variables[0] = variables[1]*variables[2]
    variables[3] = variables[4]*variables[5]
    variables[22] = variables[6]*variables[7]*log(variables[8]*variables[23])
    variables[23] = variables[3]
    variables[24] = variables[6]*variables[7]*log(variables[9]*variables[25])
    variables[25] = variables[0]


def compute_rates(voi, states, rates, variables):
    variables[32] = variables[6]*variables[7]*log(variables[16]*states[3])
    variables[35] = variables[32]
    variables[26] = variables[6]*variables[7]*log(variables[10]*states[0])
    variables[36] = variables[26]
    variables[34] = variables[18]*(exp(variables[35]/(variables[6]*variables[7]))-exp(variables[36]/(variables[6]*variables[7])))
    variables[28] = variables[6]*variables[7]*log(variables[12]*states[1])
    variables[42] = variables[28]
    variables[41] = variables[24]+variables[26]
    variables[40] = variables[20]*(exp(variables[41]/(variables[6]*variables[7]))-exp(variables[42]/(variables[6]*variables[7])))
    variables[27] = variables[34]-variables[40]
    rates[0] = variables[27]
    variables[38] = variables[28]
    variables[30] = variables[6]*variables[7]*log(variables[14]*states[2])
    variables[39] = variables[30]
    variables[37] = variables[19]*(exp(variables[38]/(variables[6]*variables[7]))-exp(variables[39]/(variables[6]*variables[7])))
    variables[29] = variables[40]-variables[37]
    rates[1] = variables[29]
    variables[44] = variables[30]
    variables[45] = variables[22]+variables[32]
    variables[43] = variables[21]*(exp(variables[44]/(variables[6]*variables[7]))-exp(variables[45]/(variables[6]*variables[7])))
    variables[31] = variables[37]-variables[43]
    rates[2] = variables[31]
    variables[33] = variables[43]-variables[34]
    rates[3] = variables[33]


def compute_variables(voi, states, rates, variables):
    variables[26] = variables[6]*variables[7]*log(variables[10]*states[0])
    variables[28] = variables[6]*variables[7]*log(variables[12]*states[1])
    variables[30] = variables[6]*variables[7]*log(variables[14]*states[2])
    variables[32] = variables[6]*variables[7]*log(variables[16]*states[3])
    variables[35] = variables[32]
    variables[36] = variables[26]
    variables[34] = variables[18]*(exp(variables[35]/(variables[6]*variables[7]))-exp(variables[36]/(variables[6]*variables[7])))
    variables[38] = variables[28]
    variables[39] = variables[30]
    variables[37] = variables[19]*(exp(variables[38]/(variables[6]*variables[7]))-exp(variables[39]/(variables[6]*variables[7])))
    variables[42] = variables[28]
    variables[41] = variables[24]+variables[26]
    variables[40] = variables[20]*(exp(variables[41]/(variables[6]*variables[7]))-exp(variables[42]/(variables[6]*variables[7])))
    variables[44] = variables[30]
    variables[45] = variables[22]+variables[32]
    variables[43] = variables[21]*(exp(variables[44]/(variables[6]*variables[7]))-exp(variables[45]/(variables[6]*variables[7])))
    variables[46] = variables[43]
    variables[47] = -variables[40]
    variables[27] = variables[34]-variables[40]
    variables[29] = variables[40]-variables[37]
    variables[31] = variables[37]-variables[43]
    variables[33] = variables[43]-variables[34]